03/05/2022"

What is ReLTER

ReLTER is an R package that: provides access to DEIMS-SDR, allows interact with software implemented by eLTER Research Infrastructure (RI) and improves the data/information shared by them.

ReLTER is born within eLTER-Plus H2020 project and it shall definitely follow the progress of (eLTER RI).

ReLTER passed the peer review of ROpenSci, the biggest R community for open tools and open science.

# Convenient way to load list of packages
pkg_list <- c("sf", "terra", "ReLTER", "tmap")
lapply(pkg_list,require, character.only = TRUE)
tmap_options(check.and.fix = TRUE)
tmap_mode("view")

How to pronounce ReLTER

riːˈɛl-tiː-iː-ɑː

Audio

How to cite ReLTER

citation("ReLTER")

## To cite the 'ReLTER' package in publications use:
##
##   Alessandro Oggioni, Micha Silver, Luigi Ranghetti & Paolo Tagliolato.
##   (2021). oggioniale/ReLTER: ReLTER v1.1.0 (1.1.0). Zenodo.
##   https://doi.org/10.5281/zenodo.5576813
##
## A BibTeX entry for LaTeX users is
##
##   @software{alessandro_oggioni_2021_5576813,
##   author       = {Alessandro Oggioni and Micha Silver and
##                   Luigi Ranghetti and Paolo Tagliolato},
##   title        = {ropensci/ReLTER: ReLTER v1.1.0},
##   year         = 2022,
##   publisher    = {Zenodo},
##   version      = {1.1.0},
##   doi          = {10.5281/zenodo.5576813},
##   url          = {https://doi.org/10.5281/zenodo.5576813}
## }

Basic functions of ReLTER

ls("package:ReLTER")
##  [1] "%>%"                            "get_activity_info"             
##  [3] "get_dataset_info"               "get_ilter_envcharacts"         
##  [5] "get_ilter_generalinfo"          "get_ilter_parameters"          
##  [7] "get_ilter_research_topics"      "get_network_envcharacts"       
##  [9] "get_network_parameters"         "get_network_related_resources" 
## [11] "get_network_research_topics"    "get_network_sites"             
## [13] "get_site_info"                  "get_site_ODS"                  
## [15] "get_sos_procedurelist"          "produce_network_points_map"    
## [17] "produce_site_map"               "produce_site_parameters_pie"   
## [19] "produce_site_parameters_waffle" "produce_site_qrcode"           
## [21] "taxon_id_pesi"                  "taxon_id_worms"

Documentation of ReLTER

Visit the ReLTER website at docs.ropensci.org/ReLTER/ for further documentation, examples, and installation of the package.

The manual of ReLTER package could be found here.

Examples: Search for DEIMS ID for a particular site (1/5)

The function get_ilter_generalinfo() allows to search by country name and site name.

Then get_site_info() obtains various metadata about a chosen site.

For this example, the Doñana LTSER Platform in Spain

donana <- ReLTER::get_ilter_generalinfo(country_name = "Spain",
                              site_name = "Doñana")
donana_id = donana$uri

Plot a basic map of that site. We use the tmap package for viewing maps.

donana_polygon <- ReLTER::get_site_info(donana_id, category = "Boundaries")
tm_basemap("OpenStreetMap.Mapnik") +
  tm_shape(donana_polygon) +
  tm_fill(col = "blue", alpha = 0.3)

Example: Retrieve metadata about a site (2/5)

This example retrieves metadata from Lock Kinord in Scotland.

loch_kinord <- ReLTER::get_ilter_generalinfo(country_name = "United K",
                              site_name = "Loch Kinord")
(loch_kinord_id = loch_kinord$uri)
## [1] "https://deims.org/9fa171d2-5a24-40d3-9c06-b3f9e9d0f270"
loch_kinord_details <- ReLTER::get_site_info(loch_kinord_id,
                                 c("Contacts", "EnvCharacts", "Parameters"))

print(paste("Site manager:",
            loch_kinord_details$generalInfo.siteManager[[1]]['name'],
            loch_kinord_details$generalInfo.siteManager[[1]]['email']))
## [1] "Site manager: Andrew Sier [Primary ECN contact] arjs@ceh.ac.uk"

# Metadata contact:
(loch_kinord_details$generalInfo.metadataProvider[[1]]['name'])
##                                name
## 1 Andrew Sier [Primary ECN contact]
## 2                    Caroline Dilks
print(paste("Average air temperature:",
            loch_kinord_details$envCharacteristics.airTemperature.avg))
## [1] "Average air temperature: 6.62"
print(paste("Annual precipitation:",
            loch_kinord_details$envCharacteristics.precipitation.annual))
## [1] "Annual precipitation: 1031.3"

print(paste("GeoBonBiome:",
            loch_kinord_details$envCharacteristics.geoBonBiome[[1]]))
## [1] "GeoBonBiome: Fresh water lakes"
# Parameters:
head(loch_kinord_details$parameter[[1]]['parameterLabel'], 12)
##                       parameterLabel
## 1                   ammonium content
## 2    benthic invertebrates abundance
## 3     benthic invertebrates presence
## 4                       conductivity
## 5                 dissolved nutrient
## 6  dissolved organic carbon in water
## 7                ecosystem parameter
## 8         inorganic nutrient content
## 9                         lake level
## 10                  lake temperature
## 11                  nitrogen content
## 12                 species abundance

Example: Query a network (3/5)

The LTER network in Slovakia

lter_slovakia_id = "https://deims.org/networks/3d6a8d72-9f86-4082-ad56-a361b4cdc8a0"
network_research_topics <- get_network_research_topics(lter_slovakia_id)

The list of research topics collected by Slovakia LTER network are:

head(network_research_topics$researchTopicsLabel, 20)
##  [1] "animal ecology"      "biodiversity"        "biology"            
##  [4] "climate change"      "climate monitoring"  "climatology"        
##  [7] "community dynamics"  "community ecology"   "ecology"            
## [10] "ecosystem ecology"   "ecosystem function"  "ecosystem service"  
## [13] "forest ecology"      "history"             "land use history"   
## [16] "meteorology"         "phenology"           "plant ecology"      
## [19] "population dynamics" "population ecology"

lter_slovakia_sites <- get_network_sites(lter_slovakia_id)

The list of the sites in Slovakia LTER network are:

lter_slovakia_sites$title
## [1] "Bab - Slovakia"                                            
## [2] "Jalovecka dolina - Slovakia"                               
## [3] "Kralova hola - Slovakia"                                   
## [4] "Kremnicke vrchy Ecological Experimental Station - Slovakia"
## [5] "Polana Biosphere Reserve (Hukavsky grun) - Slovakia"       
## [6] "Poloniny National Park LTSER - Slovakia"                   
## [7] "Tatra National Park - Slovakia"                            
## [8] "Tatras - alpine summits - Slovakia"                        
## [9] "Trnava LTSER - Slovakia"

Show map of sites in the network

lter_slovakia <- produce_network_points_map(lter_slovakia_id, "SVK")
svk <- readRDS("gadm36_SVK_0_sp.rds")  # downloaded by produce_network_points_map()
tm_basemap("OpenStreetMap.Mapnik") +
  tm_shape(lter_slovakia) +
  tm_dots(col = "blue", size=0.04) +
  tm_shape(svk) +
  tm_borders(col = "purple", lwd = 0.6) +
  tm_grid(alpha = 0.4) +
  tm_scale_bar(position = c("right", "bottom"))

Example: Related resources (4/5)

Example: map object of a site (5/5)

The produce_site_map function produces a map of the site boundaries, within a given country and network.

tmap::tmap_mode("plot")
# Example of Lake Maggiore site
sitesNetwork <- ReLTER::get_network_sites(
  networkDEIMSID = "https://deims.org/network/7fef6b73-e5cb-4cd2-b438-ed32eb1504b3"
)
# In the case of Italian sites are selected only true sites and excluded the
# macrosites.
sitesNetwork <- (sitesNetwork[!grepl('^IT', sitesNetwork$title),])
sf::st_crs(sitesNetwork) = 4326
siteMap <- ReLTER::produce_site_map(
  deimsid = "https://deims.org/f30007c4-8a6e-4f11-ab87-569db54638fe",
  countryCode = "ITA",
  listOfSites = sitesNetwork,
  gridNx = 0.7,
  gridNy = 0.35
)

ReLTER online documentation

Dependency on DEIMS-SDR

ReLTER relies on the data entered into DEIMS-SDR. However sometimes there are:

  • Multiple sites with similar names
  • Missing information
  • Sites with no boundary polygon

First example, the Kiskun region of Hungary

Query for Site Manager

# Multiple sites in the KISKUN region of Hungary
kiskun <- ReLTER::get_ilter_generalinfo(country_name = "Hungary",
                              site_name = "KISKUN")
# How many sites?
print(paste("In Kiskun region: ", length(kiskun$title), "sites"))
## [1] "In Kiskun region:  8 sites"

(kiskun$title)
## [1] "Kiskun Forest Reserve Sites, KISKUN LTER - Hungary"   
## [2] "VULCAN Kiskunsag, KISKUN LTER - Hungary"              
## [3] "Kiskun Restoration Experiments, KISKUN LTER - Hungary"
## [4] "Kiskun Site Network (Jedlik), KISKUN LTER - Hungary"  
## [5] "KISKUN LTER - Hungary"                                
## [6] "LTER Fulophaza Site, KISKUN LTER - Hungary"           
## [7] "Bugac-Bocsa-Orgovany Site, KISKUN LTER - Hungary"     
## [8] "Orgovany Site, KISKUN LTER - Hungary"
# Which site? Bugac-Bocsa
bugac_id <- kiskun[7,]$uri
bugac_details <- ReLTER::get_site_info(bugac_id,"Contacts")
(bugac_details$generalInfo.siteManager[[1]]['name'])
##          name
## 1 Gábor Ónodi

Now query for boundary

bugac_polygon <- ReLTER::get_site_info(bugac_id, "Boundaries")
## 
## ----
## This site does not have boundaries uploaded to DEIMS-SDR.
## Please verify in the site page: https://deims.org/609e5959-8cd8-44a0-ab42-eda521cd452a
## ----
str(bugac_polygon)
## tibble [1 × 9] (S3: tbl_df/tbl/data.frame)
##  $ title       : chr "Bugac-Bocsa-Orgovany Site, KISKUN LTER - Hungary"
##  $ uri         : chr "https://deims.org/609e5959-8cd8-44a0-ab42-eda521cd452a"
##  $ boundaries  : logi NA
##  $ geoCoord    : chr "POINT (19.5281 46.7183)"
##  $ country     :List of 1
##   ..$ : chr "Hungary"
##  $ geoElev.avg : int 112
##  $ geoElev.min : int 105
##  $ geoElev.max : int 120
##  $ geoElev.unit: chr "msl"
# No geometry
  • This site has the site manager’s name
  • but no boundary polygon

Second example, Gran Paradiso in Italy

paradiso <- ReLTER::get_ilter_generalinfo(country_name = "Italy",
                              site_name = "Gran Paradiso")
(paradiso$title)
## [1] "IT23 - Gran Paradiso National Park - Italy"
## [2] "Gran Paradiso National Park - Italy"
# Choose the second
paradiso_id <- paradiso[2,]$uri
paradiso_details <- ReLTER::get_site_info(paradiso_id, "Contacts")
# Multiple names for metadata:
paradiso_details$generalInfo.metadataProvider[[1]]['name']
##                 name
## 1 Alessandro Oggioni
## 2     Ramona Viterbi

# But what about funding agency
paradiso_details$generalInfo.fundingAgency
## [1] NA
  • This site has metadata providers
  • but no funding agency

Acquiring Earth Observation data

Functions within ReLTER help to acquire certain Earth Observation datasets.

The get_site_ODS() function offers to ReLTER users access to the OpenDataScience Europe (ODS) archive (https://maps.opendatascience.eu/) with landcover, NDVI, natura2000, Corine landcover, and OSM features, all at 30 meter pixel resolution. Cropping to site boundaries is done in the cloud, and due to the Cloud Optimized Geotiff (COG) format, downloads are quite small.

First example, Kis-Balaton site in Kiskun region, Hungary

# Get DEIMS ID for Kis-Balaton site 
kis_balaton <- ReLTER::get_ilter_generalinfo(country_name = "Hungary",
                              site_name = "Kis-Balaton")
kb_id = kis_balaton$uri
kb_polygon = ReLTER::get_site_info(kb_id, "Boundaries")

# Now acquire landcover and NDVI from ODS
kb_landcover = ReLTER::get_site_ODS(kb_id, dataset = "landcover")
kb_ndvi_summer = ReLTER::get_site_ODS(kb_id, "ndvi_summer")

# Plot maps
tm_basemap("OpenStreetMap.Mapnik") + 
  tm_shape(kb_polygon) +
  tm_borders(col = "purple") + 
  tm_shape(kb_ndvi_summer) +
  tm_raster(alpha=0.7, palette = "RdYlGn")

tm_basemap("OpenStreetMap.Mapnik") + 
  tm_shape(kb_polygon) +
  tm_borders(col = "purple") + 
  tm_shape(kb_landcover) +
  tm_raster(alpha=0.7, palette = "Set1")

Second example, Companhia das Lezírias, Portugal

lezirias <- ReLTER::get_ilter_generalinfo(country_name = "Portugal",
                              site_name = "Companhia")
lezirias_id = lezirias$uri
lezirias_polygon = ReLTER::get_site_info(lezirias_id, "Boundaries")

# Now acquire spring NDVI from OSD
lezirias_ndvi_spring = ReLTER::get_site_ODS(lezirias_id, "ndvi_spring")

# Plot maps
tm_basemap("OpenStreetMap.Mapnik") + 
  tm_shape(lezirias_polygon) +
  tm_borders(col = "purple") + 
  tm_shape(lezirias_ndvi_spring) +
  tm_raster(alpha=0.7, palette = "RdYlGn")

The function outputs a raster. We can save to Geotiff for use in other GIS

class(lezirias_ndvi_spring)
## [1] "SpatRaster"
## attr(,"package")
## [1] "terra"
writeRaster(x = lezirias_ndvi_spring,
            filename = "lezirias_ndvi_spring.tif",
            overwrite = TRUE)

Acquiring biodiversity data

Functions within ReLTER help to acquire certain third parties biodiversity datasets. The get_site_speciesOccurrences function1, offers to ReLTER users access to the occurrence records from GBIF (via rgbif R package), iNaturalist and OBIS carried out within the boundaries of the site.

Coauthor of these functions are Martina Zilioli and Paolo Tagliolato.

1 get_site_speciesOccurrences, map_occ_gbif2elter and save_occ_eLTER_reporting_Archive currently are delivered only with dev__withImprovements branch of ReLTER

First example, the Gulf Of Venice (GOV)

DEIMS.iD of eLTER site Gulf Of Venice (GOV)
GOVid <- "https://deims.org/758087d7-231f-4f07-bd7e-6922e0c283fd"
resGOV <- ReLTER::get_site_speciesOccurrences(
  deimsid = GOVid, list_DS = "obis", show_map = TRUE, limit = 10)

Second example, the Saldur River Catchment

# DEIMS.iD of eLTER the Saldur River Catchment site 
saldur_id <- "https://deims.org/97ff6180-e5d1-45f2-a559-8a7872eb26b1"
occ_SRC <- ReLTER::get_site_speciesOccurrences(
  deimsid = saldur_id, list_DS = c("gbif", "inat"), show_map = TRUE, limit = 100)

Trasform this data into eLTER data template

Fields mapping among the three data source schemas (i.e., GBIF, iNaturalist, OBIS) and the eLTER data-reporting template (Peterseil et al., 2021) was carried out so as to design ReLTER functions: map_occ_gbif2elter and save_occ_eLTER_reporting_Archive.

Below an example of iNaturalist export data, for the Saldur River Catchment site.

library(dplyr)
saldurid <- "https://deims.org/97ff6180-e5d1-45f2-a559-8a7872eb26b1"
resSaldur <- ReLTER::get_site_speciesOccurrences(
  deimsid = saldurid, list_DS = c("gbif", "inat"), show_map = FALSE, limit = 20,
  exclude_inat_from_gbif = TRUE)
# iNaturalist
tblSaldur_inat <- tibble::as_tibble(resSaldur$inat)
outInat <- tblSaldur_inat %>%
  ReLTER::map_occ_inat2elter(deimsid = saldurid)
ReLTER::save_occ_eLTER_reporting_Archive(outInat)

The eLTER useful archive created is:

  • biodiv_occurrence_site_97ff6180-e5d1-45f2-a559-8a7872eb26b1_inat.zip

Additional plotting functions

Environmental parameters

ReLTER has implemented some revealing visualizations of the various parameters collected at LTER sites. One visualization is the pie chart of environmental parameters.

In an example above the DEIMS ID of Kis Balaton (Kiskun LTER) was found. We’ll use that site to show a pie chart of environmental variables collected in that site.

ReLTER::produce_site_parameters_pie(kb_id)

## # A tibble: 8 × 9
##   parameterGroups            n   freq label   end start middle hjust vjust
##   <chr>                  <int>  <dbl> <chr> <dbl> <dbl>  <dbl> <dbl> <dbl>
## 1 agricultural parameter     1 0.0208 2%    0.131 0     0.0654     0     0
## 2 atmospheric parameter      1 0.0208 2%    0.262 0.131 0.196      0     0
## 3 biological parameter      16 0.333  33%   2.36  0.262 1.31       0     0
## 4 chemical parameter        16 0.333  33%   4.45  2.36  3.40       1     1
## 5 ecosystem parameter        8 0.167  17%   5.50  4.45  4.97       1     0
## 6 physical parameter         1 0.0208 2%    5.63  5.50  5.56       1     0
## 7 soil parameter             1 0.0208 2%    5.76  5.63  5.69       1     0
## 8 water parameter            4 0.0833 8%    6.28  5.76  6.02       1     0

Similarly, a “waffle” chart can be produced.

ReLTER::produce_site_parameters_waffle(kb_id)

## # A tibble: 8 × 4
##   parameterGroups            n   freq label
##   <chr>                  <int>  <dbl> <chr>
## 1 agricultural parameter     1 0.0208 2%   
## 2 atmospheric parameter      1 0.0208 2%   
## 3 biological parameter      16 0.333  33%  
## 4 chemical parameter        16 0.333  33%  
## 5 ecosystem parameter        8 0.167  17%  
## 6 physical parameter         1 0.0208 2%   
## 7 soil parameter             1 0.0208 2%   
## 8 water parameter            4 0.0833 8%

Show a chaining of several functions

This example uses the LTER network in Greece. Call the produce_network_points_map() function (requires both DEIMS network ID and the three letter ISO code for the country to be mapped) to get all sites in a country.

lter_greece_id = "https://deims.org/networks/83453a6c-792d-4549-9dbb-c17ced2e0cc3"
lter_greece <- ReLTER::produce_network_points_map(lter_greece_id, "GRC")
grc <- readRDS("gadm36_GRC_0_sp.rds")  # available from `produce_network_points_map()

tm_basemap("OpenStreetMap.Mapnik") + 
  tm_shape(lter_greece) + 
  tm_dots(col = "blue", size=0.08) +
  tm_shape(grc) + 
  tm_borders(col = "purple", lwd=2) +
  tm_grid(alpha = 0.4) +
  tm_scale_bar(position = c("right", "bottom"))

What can be done with ReLTER outputs

Each function returns an R object

  • Site metadata and info returned as a tibble
    • save as an R dataset (keeps R stucture), or
    • save to csv file
  • Boundaries are returned as an sf spatial vector layer.
    • save to a shapefile, or geopackage
  • EO data are returned as a SpatRaster object (from the terra package)
    • save as geotiff

Example from the Doñana site in Spain

donana = get_ilter_generalinfo(country_name = "Spain",
                              site_name = "Doñana")
donana_id = donana$uri
donana_polygon <- get_site_info(donana_id, category = "Boundaries")
donana_meta <-  get_site_info(donana_id,
                          c("Affiliations", "Contacts", "Parameters"))
# Get the Corine landcover from ODS
donana_clc <- get_site_ODS(donana_id, "clc2018")

Save data and spatial layers for use later, or in other GIS software

# For this demo, save to temporary directory
output_dir = tempdir()
saveRDS(donana_meta, file.path(output_dir, "Donana_metadat.Rds"))
# Remove extra columns from polygon
donana_polygon <- donana_polygon[,c("title", "boundaries", "geoCoord", "geoElev.avg")]
st_write(donana_polygon,
         file.path(output_dir, "donana_polygon.gpkg"), append=FALSE)
## Writing layer `donana_polygon' to data source 
##   `/tmp/RtmpeN1bwi/donana_polygon.gpkg' using driver `GPKG'
## Writing 1 features with 3 fields and geometry type Polygon.
writeRaster(donana_clc,
            file.path(output_dir, "Donana_Corine2018.tif"),
            overwrite=TRUE)

Future plans